import { Card } from "antd";
import { Link } from "react-router-dom";
import FromNow from "../../component/fromnow";
import TopicTag from "../../component/topicTag";

export default function Details(props) {
    const { data, loading } = props;

    console.log(data);

    let { author, content, create_at, good, top, tab, title, visit_count } =
        data;
    console.log(content);
    return (
        <Card
            bordered
            loading={loading}
            type="inner"
            title={
                <>
                    <h1>
                        <TopicTag tab={top ? "top" : good ? "good" : tab} />
                        {title}
                    </h1>
                    <p>
                        -作者：
                        <Link to={`/user/${author.loginname}`}>
                            {author.loginname}
                        </Link>
                        -创建时间：
                        <FromNow date={create_at} />
                        -浏览人数：
                        {visit_count}
                    </p>
                </>
            }
        >
            <div dangerouslySetInnerHTML={{ __html: content }}></div>
        </Card>
    );
}
